home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
By Popular Request 2.0
/
By Popular Request 2.0 (Arsenal Computer).ISO
/
amiga_5
/
sktopten.lha
/
DLTOP10
/
TOP10.REX
< prev
Wrap
OS/2 REXX Batch file
|
1994-07-25
|
6KB
|
243 lines
/****************************************************************************/
/* */
/* $VER: Top10_SkBungay 2.0 (22.08.93) */
/* */
/* The Skyline David Letterman's Top 10 lists! Version 1.0 - Dave Cole */
/* For updates/questions/whatever call Wolverine's Den (616)533-6760 */
/* Read the dox for installation, etc... */
/* Edit lines 23, 24, 25, and 26 with correct information dude! */
/* */
/* Skyline 1.3x/2.0 (beta) (89-91) DLG (92) HOTKEY (93) */
/* - Modifications By Santosh Bungay */
/* */
/* DLG implementation: rx top10.rexx %ansi %sclength */
/* */
/* CLI MODE = No */
/* */
/* Modify Line 37 ONLY */
/* */
/****************************************************************************/
OPTIONS RESULTS
arg first
parse var first ansi' 'sclength
signal on syntax
signal on IOERR
call close(stdin)
call close(stdout)
call close(stderr)
call open(stdin,"*","r")
call open(stdout,"*","w")
call open(stderr,"*","w")
filepath = "DOORS:DLTOP10/Top10Lists/" /* THE ONLY SYSOP DEFINABLE VARIABLE */
cls = '0c'x
esc = '1b'x
if upper(ansi) = 'COLOR' then do
RED = esc'[1;31m'
YEL = esc'[1;33m'
CYA = esc'[1;36m'
WHI = esc'[1;37m'
RRED = esc'[1;44;33m'
RESET = esc'[0;37m'
end
else do
RED = ''
YEL = ''
CYA = ''
WHI = ''
RRED = ''
RESET = ''
end
SELECTLIST:
rannum = Vrnd(1,4)
call Open(file,filepath'List'||rannum,'R')
call GUESS
call close(file)
call SHOWIT
signal DIE
GUESS:
do i = 1 to 40
z.i = readln(file)
end
rannum = Vrnd(1,40)
Tonight = z.rannum
parse var Tonight Subject '|' top.10 '|' top.9 '|' top.8 '|' top.7 '|' top.6 '|' top.5 '|' top.4 '|' top.3 '|' top.2 '|' top.1
return
SHOWIT:
say CLS
do x = 1 to sclength+2
say ''
end
say RESET CENTER("Late Night's Top Ten With David Letterman",78)
do x = 1 to sclength+2
say ''
end
say RESET||CLS||RRED CENTER(SUBJECT,78,' ')
say RESET
x = 10
anspos = 22
if length(top.10) > 150 then anspos = 21
if upper(ansi) = 'COLOR' then say esc"["anspos"H"
do until x = 0
if x = 2 | x = 4 | x = 6 | x = 8 | x = 10 then ANY = RESET
else ANY = WHI
if x = 1 then ANY = YEL
pre = right(x,2,' ')||'. '
if length(top.x) < 75 then do
say CYA||pre||RESET||ANY top.x
if upper(ansi) ~= 'COLOR' then say '0d'x
call del
end
if length(top.x) >= 75 & length(top.x) <= 150 then do
p = pos(" ",top.x,75)
rtop = strip(left(top.x,p),'B',' ')
say CYA||pre||RESET||ANY rtop
ltop = strip(substr(top.x,p),'B',' ')
say left(" ",length(pre)," ")' 'ltop
end
if length(top.x) > 150 then do
anspos = anspos - 1
if upper(ansi) = 'COLOR' then say ''||anspos||'H'
p = pos(" ",top.x,75)
rtop = strip(left(top.x,p),'B',' ')
say CYA||pre||RESET||ANY rtop
ttop = substr(top.x,p)
p = pos(" ",ttop,75)
mtop = strip(left(ttop,p),'B',' ')
say left(" ",length(pre)," ")' 'mtop
ltop = strip(substr(ttop,p),'B',' ')
say left(" ",length(pre)," ")' 'ltop
end
do cx = 1 to 100
call del
end
x = x - 1
anspos = anspos - 2
if upper(ansi) = 'COLOR' then say esc'['||anspos||'H'
end
if upper(ansi) = 'COLOR' then say esc'[23H'
call PressReturn
return
DEL:
do zx = 1 to 15
end
return
VRnd: procedure /* Very Random v1.1 [c] 1990 Shane D. Killian */
arg lo,hi /* Feel free to use this as long as these */
n1 = time('E') /* comments remain intact. Works like random(). */
n2 = time('S')
parse var n1 n11 '.' n12
n1 = n11 || n12
if lo > hi then do
x = lo
lo = hi
hi = x
end
if hi ~= lo then do
d = hi - lo + 1
x = length(d)
n1 = right(n1,x)
n2 = right(n2,x)
p = d
if p > 999 then p = 999
r = n1 + n2 + random(0,p)
r = r // d + lo
end
else r = hi
return r
/**********************************************/
/* */
/* HOTKEY2 by Santosh Bungay */
/* */
/* Format for HOTKEY: */
/* */
/* Question = '<question>' */
/* Answer = '' OR variable */
/* MaxLen = <maximum length of input> */
/* call LINEIN */
/* <variable> = ANSWER */
/* */
/* See PRESSRETURN: */
/* */
/**********************************************/
LINEIN:
call writech(stdout,question)
call writech(stdout,answer)
alen = length(answer)
GETKEY:
key = readch(stdin,1)
dkey = c2d(key)
if dkey = 155 then do
key = readch(stdin,1)
signal GETKEY
end
if (dkey = 13) | (dkey = 10) then do
say ''
RETURN
end
if (dkey = 8) & (alen = 0) then signal GETKEY
if dkey = 8 then do
alen = alen - 1
answer = left(answer,alen)
temp = key||' '||key
key = temp
end
if ((dkey < 32) | (dkey > 127)) & (dkey ~= 8) | (alen > maxlen) then signal GETKEY
if dkey ~= 8 then do
answer = answer || key
alen = alen + 1
end
call writech(stdout,key)
signal GETKEY
PRESSRETURN:
question = RRED'[ ]'RESET
answer = ''
maxlen = 1
call linein
if answer = 'ENDCLI' then signal DIE
return
DIE:
if upper(ansi) = "COLOR" then say RESET''esc'[A '
say RESET
BREAK_C:
SYNTAX:
IOERR:
call close(stdin)
call close(stdout)
call close(stderr)
exit